#coding:utf8
class Management():
    def __init__(self, text):
        self.text = text
    def __enter__(self):
        print 'enter'
        return self
    def __exit__(self, exc_type, exc_val, exc_tb):
        print "exit"
    def prin(self):
        print self.text



with Management("上下文管理") as manage:
    manage.prin()